<template>
  <div class="touristContainer">
    <div class="top">
      <p class="title">实时游客统计</p>
      <p class="bg"></p>
      <p class="right">
        可预约总量:
        <span>99999</span>
        人
      </p>
      <div class="number">
        <span v-for="(item, index) in people" :key="index">{{ item }}</span>
      </div>
      <!-- 盒子将来echarts展示图形图表的节点 -->
      <div class="charts" ref="charts">123</div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'
import 'echarts-liquidfill'

let people = ref('216912人')
// 获取节点
let charts = ref()

onMounted(() => {
  // 获取echarts类的实例
  let mychart = echarts.init(charts.value)
  // 设置实例的配置项
  mychart.setOption({
    // 设置标题
    title: {
      // text: '水球图',
      textStyle: {
        color: '#29fcff',
      }
    },
    // x轴组件
    xAxis: {},
    // y轴组件
    yAxis: {},
    // 系列设置: 决定展示什么样的图形图标，如果line、pie、bar等
    series: [
      {
        type: 'liquidFill',
        data: [0.6, 0.5, 0.4, 0.3],
        waveAnimation: true, // 动画
        animationDuration: 3,
        animationDurationUpdate: 0,
        radius: '80%', // 调整半径大小
        outline: {
          show: true,
          borderDistance: 8,
          itemStyle: {
            color: 'none',
            borderColor: '#294D99',
            borderWidth: 8,
            shadowBlur: 20,
            shadowColor: 'rgba(0, 0, 0, 0.25)',
          }
        },
      },
    ],
    // 布局组件
    grid: {
      left: 0,
      right: 0,
      top: 0,
      bottom: 0,
    },
  })
})
</script>
<style scoped lang="scss">
.touristContainer {
  background: url('../../images/dataScreen-main-lb.png') no-repeat;
  background-size: 100% 100%;
  margin-top: 10px;

  .top {
    .title {
      color: white;
      margin-left: 20px;
      font-size: 20px;
    }

    .bg {
      width: 68px;
      height: 7px;
      background: url('../../images/dataScreen-title.png') no-repeat;
      margin-top: 10px;
      margin-left: 20px;
    }

    .right {
      float: right;
      color: white;
      font-size: 20px;

      span {
        color: yellowgreen;
      }
    }

    .number {
      display: flex;
      padding: 10px;
      margin-top: 30px;

      span {
        flex: 1;
        height: 50px;
        text-align: center;
        line-height: 50px;
        background: url('../../images/total.png') no-repeat;
        background-size: 100% 100%;
        color: #29fcff;
        font-size: 30px;
        margin: 0px 1px;
      }
    }

    .charts {
      width: 100%;
      height: 260px;
      // background: red;
    }
  }
}
</style>
